<!DOCTYPE html>
<!-- 
Template Name: Metronic - Responsive Admin Dashboard Template build with Twitter Bootstrap 3.1.1
Version: 2.0.2
Author: KeenThemes
Website: http://www.keenthemes.com/
Contact: support@keenthemes.com
Purchase: http://themeforest.net/item/metronic-responsive-admin-dashboard-template/4021469?ref=keenthemes
License: You must have a valid license purchased only from themeforest(the above link) in order to legally use the theme for your project.
-->
<!--[if IE 8]>
<html lang="en" class="ie8 no-js">
	<![endif]-->
	<!--[if IE 9]>
	<html lang="en" class="ie9 no-js">
		<![endif]-->
		<!--[if !IE]>
		<!-->
		<!--<![endif]-->
		<!-- BEGIN HEAD -->
		<!-- BEGIN BODY -->
		<style type="text/css">
	.table_btn_box{
		margin-bottom: 5px;
		float: left;
	}

	.btn-div{
		float: left;top: 10px;margin-bottom: 5px;padding-left: 10px;
	}
	.abnormal{
		position: absolute;
		top: 0px;
		left: 600px;
	}
	.u_abnormal{
		position: absolute;
		top: 0px;
		left: 600px;
	}
	.row{
		margin: 0;
	}
</style>
<body class="page-header-fixed">
		<div  class="btn-div">
			<a class="btn blue" href="javascript:;"  data-target="#sysUserModel" 
data-toggle="modal" ng-click="addSysUser();"> <i class="fa fa-plus"></i>
				新增
			</a>
		</div>
		<table class="table table-striped table-bordered table-hover" id="table_1">
			<thead>
				<tr>
					<th>账户</th>
					<th>名字</th>
					<th>归属类型</th>
					<th>归属实体</th>
					<th>操作权限</th>
					<th>是否使用</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<tr class="odd gradeX" ng-repeat="sysUser in sysUserList  track by $index" pg-loaded="{{$last}}" target-table="table_1">
					<td>
						<span ng-bind="sysUser.account"></span>
					</td>
					<td>
						<span ng-bind="sysUser.oper_name | commonSubString"></span>
					</td>
					<td>
						<span ng-bind="sysUser.entity_type | getValueInStaticFilter : 'entityTypeArray'"></span>
					</td>

					<td>
						<span ng-bind="sysUser.entity_name | commonSubString"></span>
					</td>
					<td>
						<span ng-bind="sysUser.auth_range | getValueInStaticFilter : 'handlerChargerAuthArray'"></span>
					</td>
					<td>
						<span ng-bind="sysUser.valid_flag | getValueInStaticFilter : 'validArray'"></span>
					</td>
					<td>
						<a class="btn" href="javascript:;"  data-target="#sysUserModel" 
	data-toggle="modal" ng-click="updateSysUser(sysUser);">修改</a>
						<a ng-if="sysUser.valid_flag==1" class="btn" href="javascript:;"  data-target="#sysUserRoleModel" 
	data-toggle="modal" ng-click="allotRole(sysUser);">角色分配</a>
						<a class="btn" href="javascript:;"  data-target="#allotStationManage" 
	data-toggle="modal" ng-click="stationManage(sysUser);" 
	ng-if="sysUser.auth_range==1">电站分配</a>
					</td>
				</tr>
			</tbody>
		</table>
	<tm-pagination conf="paginationConf"></tm-pagination>	
		<div id="sysUserModel" class="modal fade" role="dialog" aria-hidden="true" data-backdrop="false">
			<div class="modal-dialog">
				<div class="modal-content">					
				<form class="w5c-form demo-form" role="form" w5c-form-validate="vm.validateOptions" novalidate name="validateForm">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true" ng-click="validateForm.reset()">×</button>
						<h4 class="modal-title">操作员新增/修改</h4>
					</div>

						<div class="modal-body form">
							<div class="form-group">
								<div class="row">
									<label class="col-sm-3 control-label text-right">
										<span class="star-color">
											<span class="star-color">*</span>
										</span>
										 手机号码
									</label>
									<div class="col-sm-8">
										<div class="input-group">
											<input type="text" class="form-control " ng-model="selectedSysUser.account" required="" name="account" ng-pattern="/^\d{11}$/"/>
										</div>
									</div>
								</div>
								<div class="row">
									<label class="col-sm-3 control-label text-right">
										
											<span class="star-color">*</span>
										
										名称
									</label>
									<div class="col-sm-8">
										<div class="input-group">
											<input type="text" class="form-control"  ng-model="selectedSysUser.oper_name" required="" name="oper_name" ng-maxlength="50"/>
										</div>
									</div>
								</div>

								<div class="row">
									<label class="col-sm-3 control-label text-right">
										<span class="star-color">* </span>
										归属类型
									</label>
									<div class="col-md-8 paddingTop">
										<div class="radio-list">
											<label class="radio-inline">
												<input ng-model="selectedSysUser.entity_type" type="radio"  value="1" 
							ng-selected="selectedSysUser.entity_type==1">运营商</label>
											<label class="radio-inline">
												<input ng-model="selectedSysUser.entity_type" type="radio"  value="2" 
							ng-selected="selectedSysUser.entity_type==2">运营商分支机构</label>
										</br>
										<label style="padding: 0" class="radio-inline">
											<input ng-model="selectedSysUser.entity_type" type="radio"  value="3" 
							ng-selected="selectedSysUser.entity_type==3">厂商</label>
										<label style="padding-left:34px" class="radio-inline">
											<input ng-model="selectedSysUser.entity_type" type="radio"  value="4" 
							ng-selected="selectedSysUser.entity_type==4">商户</label>
									</div>
								</div>
							</div>
							<div class="row">
								<label class="col-sm-3 control-label text-right">
									<span class="star-color">* </span>
									归属对象
								</label>
								<div class="col-sm-8">
									<div class="input-group">
										<select class="form-control" 
						ng-if="!!selectedSysUser.entity_type&&selectedSysUser.entity_type==1"
						ng-options="operMechant.oper_merchant_id as operMechant.oper_name for operMechant in operMechantList "  
						ng-model="selectedSysUser.entity_id"  id="selectEntity">
											<option value="">请选择运营商</option>
										</select>
										<select class="form-control" 
						ng-if="!!selectedSysUser.entity_type&&selectedSysUser.entity_type==2"
						ng-options="operMerchantBranch.oper_merchant_branch_id as operMerchantBranch.oper_name for operMerchantBranch in operMerchantBranchList " 
						ng-model="selectedSysUser.entity_id" id="selectEntity">
											<option value="">请选择运营商分支机构</option>
										</select>
										<select class="form-control" 
						ng-if="!!selectedSysUser.entity_type&&selectedSysUser.entity_type==3"
						ng-options="factory.factory_id as factory.factory_name for factory in factoryList " 
						ng-model="selectedSysUser.entity_id" id="selectEntity">
											<option value="">请选择厂商</option>
										</select>
										<select class="form-control" 
						ng-if="!!selectedSysUser.entity_type&&selectedSysUser.entity_type==4"
						ng-options="merchant.merchant_id as merchant.name for merchant in merchantList " 
						ng-model="selectedSysUser.entity_id" id="selectEntity">
											<option value="">请选择商户</option>
										</select>
									</div>
								</div>
							</div>
							<div class="row" ng-if="!!selectedSysUser.entity_type&&(selectedSysUser.entity_type==1||selectedSysUser.entity_type==2||selectedSysUser.entity_type==4)">
								<label class="col-sm-3 control-label text-right">
									<span class="star-color">* </span>
									操作权限
								</label>
								<div class="col-md-8 paddingTop">
									<div class="radio-list">
										<label class="radio-inline">
											<input ng-model="selectedSysUser.auth_range" type="radio"  value="0" 
							ng-selected="selectedSysUser.auth_range==0">实体下所有站</label>
										<label style="padding-left:34px" class="radio-inline">
											<input ng-model="selectedSysUser.auth_range" type="radio"  value="1" 
							ng-selected="selectedSysUser.auth_range==1">特定站</label>
									</div>
								</div>
							</div>

							<div class="row">
								<label class="col-sm-3 control-label text-right">身份证号</label>
								<div class="col-sm-8">
									<div class="input-group">
										<input type="text" class="form-control" ng-model="selectedSysUser.id_card" name="id_card" ng-pattern="/(^\d{15}$)|(^\d{17}([0-9]|X)$)/"/>
									</div>
								</div>
							</div>
							<div class="row">
								<label class="col-sm-3 control-label text-right">邮箱</label>
								<div class="col-sm-8">
									<div class="input-group">
										<input type="text" class="form-control" ng-model="selectedSysUser.email" ng-pattern="/^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/" name="email"/>
									</div>
								</div>
							</div>
							<div class="row">
								<label class="col-sm-3 control-label text-right">公司名</label>
								<div class="col-sm-8">
									<div class="input-group">
										<input type="text" class="form-control" ng-model="selectedSysUser.company" name="company"/>
									</div>
								</div>
							</div>
							<div class="row" ng-if="'insert'!=modifyType">
								<label class="col-sm-3 control-label text-right">
									<span class="star-color">*</span>
									是否启用
								</label>
								<div class="col-md-8 paddingTop">
									<div class="radio-list">
										<label  class="radio-inline col-md-4" style="margin:0px;padding: 0px">
											<input ng-model="selectedSysUser.valid_flag" type="radio"  value="1" 
							ng-selected="selectedSysUser.valid_flag==1">启用</label>
										<label  class="radio-inline col-md-4" style="margin:0px;padding: 0px">
											<input ng-model="selectedSysUser.valid_flag" type="radio"  value="0" 
							ng-selected="selectedSysUser.valid_flag==0">停用</label>
									</div>
								</div>
							</div>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-danger" data-dismiss="modal" ng-click="validateForm.reset()"> <i class="fa fa-times"></i>
							关闭
						</button>
						<button type="button" class="btn btn-primary" w5c-form-submit="modifySysUser();">
							<i class="fa fa-check"></i>
							保存
						</button>
					</div>
				</form>
			</div>
		</div>
	</div>

	<div id="sysUserRoleModel" class="modal fade" role="dialog" aria-hidden="true"  data-backdrop="false">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
					<h4 class="modal-title">角色分配管理</h4>
				</div>
				<div class="modal-body form">
					<div class="form-group alert row">
						<div class="col-sm-5" style="padding:0px">
							<p class="selectAllTit">可分配角色</p>
							<select multiple="multiple" class="selectAll" id="leftSelect">
								<option ng-dblclick="selectRole(allotRole,$index);" value="{{$index}}" 
						ng-repeat="allotRole in allotRoleList track by $index" >{{allotRole.role_name}}</option>
							</select>
						</div>
						<div class="col-sm-2" style="color:#018DAE;padding-top:80px;text-align: center">
							<a style="display: block;">
								<i class="fa fa-chevron-circle-left" style="font-size: 30px;line-height:50px;cursor: pointer;" ng-click="leftClick();"></i>
							</a>
							<a style="display: block;">
								<i class="fa fa-chevron-circle-right" style="font-size: 30px;line-height:50px;cursor: pointer;" ng-click="rightClick();"></i>
							</a>
						</div>
						<div class="col-sm-5" style="padding:0px">
							<p class="selectAllTit">已分配角色</p>
							<select multiple="multiple" class="selectAll" id="rightSelect">
								<option ng-dblclick="invertSelectRole(allotedRole,$index);" value="{{$index}}" 
						ng-repeat="allotedRole in allotedRoleList track by $index">{{allotedRole.role_name}}</option>
							</select>
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-danger" data-dismiss="modal">
						<i class="fa fa-times"></i>
						关闭
					</button>
					<button type="button" class="btn btn-primary" ng-click="batchAllotRole();">
						<i class="fa fa-check"></i>
						保存
					</button>
				</div>
			</div>
		</div>
	</div>

	<div id="allotStationManage" class="modal fade" role="dialog" aria-hidden="true" data-backdrop="false" >
		<div class="modal-dialog" style="width:1000px">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
								aria-hidden="true">×</button>
					<h4 class="modal-title">操作员管理电站维护</h4>
				</div>

				<div class="modal-body form">

					<div class="form-group">
						<div class="table_btn_box">
							<a class="btn blue" href="javascript:;" ng-click="changeStationList('alloted');">显示已管理电站</a>
							<a class="btn blue" href="javascript:;" ng-click="changeStationList('unAllot');">显示可管理电站</a>
							<a class="btn blue u_abnormal" href="javascript:;"  
									ng-click="relevanceStation();" ng-if="relevanceFlag=='unAllot'">分配管理</a>
							<a class="btn blue abnormal" href="javascript:;" 
									ng-click="relevanceStation();" ng-if="relevanceFlag=='alloted'">取消管理</a>
						</div>
						<table class="table table-striped table-bordered table-hover"
									id="table_2">
							<thead>
								<tr>
									<th class="table-checkbox">
										<input type="checkbox" class="checkbox_table" />
									</th>
									<th>站ID</th>
									<th>站点名称</th>
								</tr>
							</thead>
							<tbody>
								<tr class="odd gradeX"
											ng-repeat="station in stationList  track by $index"
											on-loaded="{{$last}}" target-table="table_2">
									<td>
										<input type="checkbox" class="checkboxes" value="{{station.station_id}}" name="stationRowModel"/>
									</td>
									<td>
										<span ng-bind="station.station_id"></span>
									</td>
									<td>
										<span ng-bind="station.station_name | commonSubString"></span>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-danger" data-dismiss="modal">
						<i class="fa fa-times"></i>
						关闭
					</button>
				</div>
			</div>
		</div>

	</div>

</body>

</html>